<?php


namespace App\Http\Controllers\applets\validate;


use Illuminate\Support\Facades\Validator;

class Sn
{
    public static function getBrowserUrlInfo($param){
        $rules = [
            'type'=>'required|numeric',
            'num'=>'required|numeric',
        ];
        $msg = [

            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'num.required'=>'浏览器编号为空',
            'num.numeric'=>'浏览器编号格式不对',
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addBrowser($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
            'address'=>'required',
            'type'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
            'address.required'=>'网址为空',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对'
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editBrowser($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
            'address'=>'required',
            'num'=>'required|numeric',
            'type'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
            'address.required'=>'网址为空',
            'num.required'=>'编号为空',
            'num.numeric'=>'编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteBrowser($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
            'num'=>'required|numeric',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn编号格式不对',
            'num.required'=>'浏览器编号为空',
            'num.numeric'=>'浏览器编号格式不对',
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function getBrowser($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function getSetting($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editSetting($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
            'type'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function getAppInstall($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function appUninstall($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editAppInstall($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
            'type'=>'required|numeric'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function querySnIdScreenshot($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function sendScreenshot($param){
        $rules = [
            'id'=>'required|numeric',
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip'
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对'
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function longRangeControl($param){
        $rules = [
            'id'=>'required|numeric',
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'type'=>'required',
        ];
        $msg = [
            'type.required'=>'类型为空',
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对'
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function screenIsLock($param){
        $rules = [
            'id'=>'required|numeric',
            'is_screen_lock'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
            'is_screen_lock.required'=>'锁屏参数为空',
            'is_screen_lock.numeric'=>'锁屏参数格式不对'
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryTimeControl($param){
        $rules = [
            'id'=>'required|numeric',
            'type'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function addTimeControl($param){
        $rules = [
            'id'=>'required|numeric',
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'startTime'=>'required',
            'endTime'=>'required',
            'type'=>'required',
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'startTime.required'=>'开始时间为空',
            'endTime.required'=>'结束时间为空',
            'type.required'=>'类型为空',
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function updateTimeControl($param){
        $rules = [
            'id'=>'required|numeric',
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'startTime'=>'required',
            'endTime'=>'required',
            'tid'=>'required',
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'startTime.required'=>'开始时间为空',
            'endTime.required'=>'结束时间为空',
            'tid.required'=>'编号为空',
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteTimeControl($param){
        $rules = [
            'id'=>'required|numeric',
            'tid'=>'required',
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip'
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对',
            'tid.required'=>'编号为空',
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对'
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteScreenshot($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'sn编号为空',
            'id.numeric'=>'sn格式不对'
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }
}